<?php
	class Admin extends CI_Controller {
	   
       function __construct() {
	       parent::__construct();
           $this->load->model('Users_db','User');
	   }
       
       function index() {
            
           $user = $this->session->userdata('user');
           if (!$user) redirect('admin/login');
       }
       
       function login() {
            if ($this->session->userdata('user')) redirect('admin');            
            
            if($this->session->userdata('user'))    redirect('');
            if($this->input->post("username")) {
                $data["username"] = $this->input->post("username",true);
                $data["password"] = md5($this->input->post("password",true));
                $objuser = $this->User->getUser($data);
                
                if($objuser) {
                    
                }
            }
            $data["title"] = lang("login_title");
            $this->load->view('login',$data);
       }
       
       function logout() {
            $this->session->sess_destroy();
            redirect('login');
       }
       
	}

/* End of file */